<script type="text/javascript">
<!--
$(function(){

	$("#content").height($(".column1").height());

	$(".achiveaction a").click(function(){
		href = $(this).attr("href");
		object = $(this);
		$.post(href,function(data){
			if(data == 'ok'){
				object.parent().parent().css({background:'yellow'}).slideUp();
			}
		});
		return false;
	});
	
	$(".arc").hover(function(){
		href = $(this).find(".arc-title").find("a").attr("href");
		href = href.replace(/saveback/,'achiveview');
//		alert(href);
		$("#achive-view").load(href);
	});

	$(".arc-title").css({'cursor':'pointer'}).click(function(){
		$(this).siblings(".arc-content").slideToggle();
	});

	$("#achive-show").css({'cursor':'pointer','float':'right'}).toggle(function(){
		$(".arc-title").siblings(".arc-content").slideUp();
		$(this).text("展开所有摘要>> ");
	},function(){
		$(".arc-title").siblings(".arc-content").slideDown();
		$(this).text("收起所有摘要<< ");
	});

	$(".box-title").css({'cursor':'pointer'});
	$("#achive-delete").css({'cursor':'pointer'}).click(function(){

		var ids = '';
		$("input[name=achiveitem]").each(function(i){
			if($(this).attr("checked") == true){
				ids += $(this).val()+',';
			}
		});

		var dd = ids.split(',');
		dd.pop();

	    $.msgbox({
			height:100,
	        width:250,
	        content:{type:'confirm', content: '确认要把文章放入回收站吗？'},
	        animation:4,
	        onClose:function(v){
						if(v){	                       

							
			                for(i=0;i<dd.length;i++){
				                src = '<?php echo $this->createUrl('news/achiveremove');?>';

//				                alert($("#"+dd[i]).parent().parent().html());
				                var object = dd[i];
				                $.get(src,{'id':dd[i]},function(data){
			                          
		                            if(data == "ok"){ 
//			                            alert(data);
		                            	$("#"+object).parent().parent().css({background:'yellow'}).slideUp();
//		                            	$("input[value="+dd[i]+"]").parent().parent().css({background:'yellow'}).slideUp();
		                            }
		                        }); 

			                }
                  
	                }
	                
			}
		}); 
		
		
	});

});

function checkAll(object){
    $("input[name=achiveitem]").each(function(){
        if($(object).attr("checked") == true){
            $(this).attr("checked",true);
        }else{
            $(this).attr("checked",false);
        }
    });
}
//-->
</script>
<div class="column1 colborder" id="achive-list">
	<div class="box">
		<?php $this->beginWidget('zii.widgets.CPortlet', array('title'=>'Achives',	));?>
			
			<div class="box-content">			
			<div clas="box-title">
				<span><input type="checkbox" name="checkAll" id="checkAll" onclick="checkAll($(this));" />全选</span>	&nbsp;&nbsp;
				<span id="achive-delete">删除</span>
				<span id="achive-show">收起所有摘要<< </span>
			</div>
			<hr />
				<?php foreach ($model as $data): ?>
					<?php $this->renderPartial('_alist',array('data'=>$data));?>
				<?php endforeach;?>
			</div>	
		<?php $this->endWidget();?>
	</div>
</div>
<div class="column2" id="achive-view" style="position:relative;">

</div>

<?php $this->widget('ext.scrollfollow.scrollfollowWidget',array(
		'id'=>'#achive-view'
))?>



